#pragma once
#ifndef WSDK_H
#define WSDK_H
#include "WhaleSDK_global.h"

#define WKE_CALL_TYPE __cdecl
typedef void(WKE_CALL_TYPE* LogCallback)(const char* logInfo);


namespace WhaleDataSDK
{
    /*
    *日志接口回调
    */
    WHALESDK_EXPORT void SetWhaleSDKLog(LogCallback logCallback);

    /*
    *SDK资源释放
    */
    WHALESDK_EXPORT void Release();
    /*
    *SDK初始化
    */
    WHALESDK_EXPORT bool InitWhaleSDK(const char* configJson);
    /*
    *SDK设置设备ID
    */
    WHALESDK_EXPORT void SetDeviceId(const char* deviceId);
    WHALESDK_EXPORT void GetDeviceId(char* deviceId);
    WHALESDK_EXPORT void SetAuthToken(const char* token);
    WHALESDK_EXPORT void OnAccountLogin(const char* account);
    WHALESDK_EXPORT void OnRoleLogin(const char* roleJson);
    WHALESDK_EXPORT void OnAccountLogout();
    WHALESDK_EXPORT void OnConnect();
    WHALESDK_EXPORT void OnEvent(const char* eventId, const char* eventDesc, const char* jsonBody);
    WHALESDK_EXPORT void OnEventSync(const char* eventId, const char* eventDesc, const char* jsonBody);
    WHALESDK_EXPORT void OnRoleLogout();
    WHALESDK_EXPORT void OnRoleLevelUp(int roleLevel);
    WHALESDK_EXPORT void OnPayFinish(const char* payJson);
    WHALESDK_EXPORT void OnBtPayOrderCancel(const char* payJson);
    WHALESDK_EXPORT void OnBtPayFail(const char* payJson);
    WHALESDK_EXPORT void OnBtPayOther(const char* payJson);
    WHALESDK_EXPORT void OnBtPayProgress(const char* payJson);
    WHALESDK_EXPORT void OnBtGameXgPay(const char* gameTradeNo);
    WHALESDK_EXPORT void OnMissionBegin(const char* missionJson);
    WHALESDK_EXPORT void OnMissionSuccess(const char* missionJson);
    WHALESDK_EXPORT void OnMissionFail(const char* missionJson);
    WHALESDK_EXPORT void OnMissionEndEvent(const char* missionResult, const char* missionJson);
    WHALESDK_EXPORT void OnVirtualCurrencyGain(const char* virtualCurrencyGainJson);
    WHALESDK_EXPORT void OnVirtualCurrencyGainForPurchased(const char* virtualCurrencyJson, const char* tradeNo);
    WHALESDK_EXPORT void OnVirtualCurrencyConsume(const char* virtualCurrencyConsumeJson);
    WHALESDK_EXPORT void OnItemGain(const char* itemGainJson);
    WHALESDK_EXPORT void OnItemConsume(const char* itemConsumeJson);
    WHALESDK_EXPORT void OnGameLoadResource();
    WHALESDK_EXPORT void OnGameLoadConfig();
    WHALESDK_EXPORT void OnOpenAnnouncement();
    WHALESDK_EXPORT void OnCloseAnnouncement();
    WHALESDK_EXPORT void OnNewUserMission();
    WHALESDK_EXPORT void OnScanResultSuccess(const char* account, const char* phoneInfoJson);
    WHALESDK_EXPORT void OnScanResultFail(const char* msgCode, const char* msg, const char* phoneInfoJson);
    WHALESDK_EXPORT void OnClickDownloadLink(const char* phoneInfoJson);
    WHALESDK_EXPORT void OnRegister(const char* roleJson);
    WHALESDK_EXPORT void OnSelectProduct(const char* productId);
    WHALESDK_EXPORT void OnGameCreateOrderResult(const char* productId, const char* state, const char* gameTradeNo, const char* nOrderCreateCode, const char* szOrderCreateMsg);
    WHALESDK_EXPORT void OnPrivateFunCodeUse(const char* funCodeJson);
    WHALESDK_EXPORT void OnPublicFunCodeUse(const char* funCodeJson);
    WHALESDK_EXPORT void OnFunCodeUse(const char* funCodeJson, const char* scope);
    /*
    *添加common共有属性, 会附着到header上
    */
    WHALESDK_EXPORT void AddAttribute(const char* key, const char* value);
    /*
    *删除common共有属性
    */
    WHALESDK_EXPORT void RemoveAttribute(const char* key);

    WHALESDK_EXPORT void OnPayFail(const char* payJson, const char* payResultJson);
    WHALESDK_EXPORT void OnPayCancel(const char* payJson, const char* payResultJson);
    WHALESDK_EXPORT void OnPaySuccess(const char* payJson, const char* payResultJson);
    WHALESDK_EXPORT void OnPayOthers(const char* payInfo, const char* payResultJson);

    WHALESDK_EXPORT void OnScanStart();
    WHALESDK_EXPORT void OnAccountRegister(const char* accountId, const char* ext);
    //西瓜开始登录界面时调用
    WHALESDK_EXPORT void OnLogin();
    //西瓜开始付费界面时调用
    WHALESDK_EXPORT void OnPay();
    //西瓜开始初始化时调用
    WHALESDK_EXPORT void OnInitStart();

    WHALESDK_EXPORT void OnPushMessage(const char* pushInfoJson);
    WHALESDK_EXPORT void OnInitFail(int code, const char* msg, const char* channelCode);
    WHALESDK_EXPORT void OnInitSuccess(int code, const char* msg, const char* channelCode);
    WHALESDK_EXPORT void OnLoginSuccess(int code, const char* authInfo);
    WHALESDK_EXPORT void OnLoginFail(int code, const char* msg, const char* channelCode);
    WHALESDK_EXPORT void OnLoginCancel(int code, const char* msg);
}
#endif // WSDK_H
